<?php

require_once(sfConfig::get('sf_lib_dir').'/filter/base/BaseFormFilterPropel.class.php');

/**
 * SfGuardUserProfile filter form base class.
 *
 * @package    virtualdelivery
 * @subpackage filter
 * @author     Your name here
 */
class BaseSfGuardUserProfileFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'usr_id'              => new sfWidgetFormPropelChoice(array('model' => 'sfGuardUser', 'add_empty' => true)),
      'usr_type'            => new sfWidgetFormFilterInput(),
      'usr_surname'         => new sfWidgetFormFilterInput(),
      'usr_name'            => new sfWidgetFormFilterInput(),
      'usr_phone'           => new sfWidgetFormFilterInput(),
      'usr_alternate_phone' => new sfWidgetFormFilterInput(),
      'usr_movil'           => new sfWidgetFormFilterInput(),
      'usr_ids_id'          => new sfWidgetFormPropelChoice(array('model' => 'PersonalIds', 'add_empty' => true)),
      'usr_ids_nro'         => new sfWidgetFormFilterInput(),
      'usr_sta_id'          => new sfWidgetFormPropelChoice(array('model' => 'GeoStates', 'add_empty' => true)),
      'usr_cty_id'          => new sfWidgetFormPropelChoice(array('model' => 'GeoCities', 'add_empty' => true)),
      'usr_address'         => new sfWidgetFormFilterInput(),
      'usr_address_nro'     => new sfWidgetFormFilterInput(),
      'usr_address_floor'   => new sfWidgetFormFilterInput(),
      'usr_address_dpt'     => new sfWidgetFormFilterInput(),
      'usr_email'           => new sfWidgetFormFilterInput(),
      'usr_birthday_date'   => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'usr_corporate_cuit'  => new sfWidgetFormFilterInput(),
      'usr_corporate_name'  => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'usr_id'              => new sfValidatorPropelChoice(array('required' => false, 'model' => 'sfGuardUser', 'column' => 'id')),
      'usr_type'            => new sfValidatorPass(array('required' => false)),
      'usr_surname'         => new sfValidatorPass(array('required' => false)),
      'usr_name'            => new sfValidatorPass(array('required' => false)),
      'usr_phone'           => new sfValidatorPass(array('required' => false)),
      'usr_alternate_phone' => new sfValidatorPass(array('required' => false)),
      'usr_movil'           => new sfValidatorPass(array('required' => false)),
      'usr_ids_id'          => new sfValidatorPropelChoice(array('required' => false, 'model' => 'PersonalIds', 'column' => 'ids_id')),
      'usr_ids_nro'         => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'usr_sta_id'          => new sfValidatorPropelChoice(array('required' => false, 'model' => 'GeoStates', 'column' => 'sta_id')),
      'usr_cty_id'          => new sfValidatorPropelChoice(array('required' => false, 'model' => 'GeoCities', 'column' => 'cty_id')),
      'usr_address'         => new sfValidatorPass(array('required' => false)),
      'usr_address_nro'     => new sfValidatorPass(array('required' => false)),
      'usr_address_floor'   => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'usr_address_dpt'     => new sfValidatorPass(array('required' => false)),
      'usr_email'           => new sfValidatorPass(array('required' => false)),
      'usr_birthday_date'   => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'usr_corporate_cuit'  => new sfValidatorPass(array('required' => false)),
      'usr_corporate_name'  => new sfValidatorPass(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('sf_guard_user_profile_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'SfGuardUserProfile';
  }

  public function getFields()
  {
    return array(
      'id'                  => 'Number',
      'usr_id'              => 'ForeignKey',
      'usr_type'            => 'Text',
      'usr_surname'         => 'Text',
      'usr_name'            => 'Text',
      'usr_phone'           => 'Text',
      'usr_alternate_phone' => 'Text',
      'usr_movil'           => 'Text',
      'usr_ids_id'          => 'ForeignKey',
      'usr_ids_nro'         => 'Number',
      'usr_sta_id'          => 'ForeignKey',
      'usr_cty_id'          => 'ForeignKey',
      'usr_address'         => 'Text',
      'usr_address_nro'     => 'Text',
      'usr_address_floor'   => 'Number',
      'usr_address_dpt'     => 'Text',
      'usr_email'           => 'Text',
      'usr_birthday_date'   => 'Date',
      'usr_corporate_cuit'  => 'Text',
      'usr_corporate_name'  => 'Text',
    );
  }
}
